Skip to content

fix(dashboard): apply labels mapping for list options in config renderer#6844

Open
Foolllll-J wants to merge 1 commit intoAstrBotDevs:masterfrom
Foolllll-J:fix/list-options-labels
Open

fix(dashboard): apply labels mapping for list options in config renderer#6844
Foolllll-J wants to merge 1 commit intoAstrBotDevs:masterfrom
Foolllll-J:fix/list-options-labels

Conversation

@Foolllll-J
Copy link

@Foolllll-J Foolllll-J commented Mar 23, 2026

修复配置页面中 list 类型选项显示异常的问题。
此前会显示 value,而不是 _conf_schema.json 中配置的 label,导致可读性较差。

Modifications / 改动点

  • 调整配置渲染逻辑,统一使用 title/value 映射渲染 list 选项。
  • 修复多选场景下选中项与下拉项显示,确保展示 label 而不是原始 value
  • 主要修改文件:
    • dashboard/src/components/shared/ConfigItemRenderer.vue
  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

修改后:
图片

修改前:
图片


Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”

  • 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Fix the dashboard config renderer so list-type options correctly use mapped titles/values for display and selection.

Bug Fixes:

  • Ensure list-type configuration options display their labels instead of raw values in the dashboard.
  • Correct multi-select list rendering so selected and dropdown items consistently show user-facing labels.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 23, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • Now that list options use getSelectItems(itemMeta) with item-title/item-value, consider reusing the same mapping helper for the generic v-select branch below to keep option shaping consistent across types.
  • Double-check that modelValue for list fields remains aligned with the new item-value="value" mapping (especially for multi-select), and that getSelectItems gracefully handles both raw values and pre-shaped { title, value } options to avoid double-mapping.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Now that `list` options use `getSelectItems(itemMeta)` with `item-title`/`item-value`, consider reusing the same mapping helper for the generic `v-select` branch below to keep option shaping consistent across types.
- Double-check that `modelValue` for `list` fields remains aligned with the new `item-value="value"` mapping (especially for multi-select), and that `getSelectItems` gracefully handles both raw values and pre-shaped `{ title, value }` options to avoid double-mapping.

## Individual Comments

### Comment 1
<location path="dashboard/src/components/shared/ConfigItemRenderer.vue" line_range="89-98" />
<code_context>
     </div>

-    <v-combobox
+    <v-select
       v-else-if="itemMeta?.type === 'list' && itemMeta?.options"
       :model-value="modelValue"
</code_context>
<issue_to_address>
**question (bug_risk):** Switch from v-combobox to v-select removes ability to enter arbitrary values

This change removes free-form input: `v-select` only allows choosing from predefined items, while `v-combobox` also accepted arbitrary text. For `type === 'list'` configs, this could break cases where users rely on adding values not in `options`. If free-form entry is still required, consider keeping `v-combobox` or adding explicit support for custom values; otherwise, please confirm no existing configs depend on non-predefined entries.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +89 to 98
<v-select
v-else-if="itemMeta?.type === 'list' && itemMeta?.options"
:model-value="modelValue"
@update:model-value="emitUpdate"
:items="itemMeta.options"
:items="getSelectItems(itemMeta)"
item-title="title"
item-value="value"
:disabled="itemMeta?.readonly"
density="compact"
variant="outlined"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (bug_risk): Switch from v-combobox to v-select removes ability to enter arbitrary values

This change removes free-form input: v-select only allows choosing from predefined items, while v-combobox also accepted arbitrary text. For type === 'list' configs, this could break cases where users rely on adding values not in options. If free-form entry is still required, consider keeping v-combobox or adding explicit support for custom values; otherwise, please confirm no existing configs depend on non-predefined entries.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the display of list type configuration options in the dashboard. It corrects an issue where the raw value was being displayed instead of the more user-friendly label defined in the configuration schema. The changes ensure a consistent and readable presentation of configuration options, especially in multi-select scenarios.

Highlights

  • Configuration Display Fix: Addresses an issue where list type options in the configuration page were displaying the value instead of the configured label from _conf_schema.json, improving readability.
  • Unified Rendering Logic: Implements a consistent title/value mapping for rendering list options.
  • Multi-Select Enhancement: Ensures that selected items and dropdown options in multi-select scenarios display the label instead of the raw value.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added the area:webui The bug / feature is about webui(dashboard) of astrbot. label Mar 23, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次 PR 成功修复了配置页面中 list 类型(多选)选项无法正确显示 label 的问题。通过将 v-combobox 替换为 v-select 并正确地提供了 itemsitem-titleitem-value,确保了标签的正确显示,同时限制了用户只能从预定义列表中选择,增强了数据规范性。代码改动正确且有效。

另外,我注意到一个相关的潜在问题:在 ConfigItemRenderer.vue 的 105-115 行,用于单选列表的 v-select 组件也调用了 getSelectItems,但缺少 item-titleitem-value 属性,这可能在有 labels 的情况下导致显示错误。建议在后续 PR 中修复此问题以保证一致性。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webui The bug / feature is about webui(dashboard) of astrbot. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant